import request from '../index'

/**
 * 获取文章列表
 * @param userId {string | number}
 * @param offset {string | number}
 * @param limit {string | number}
 * @returns {Promise}
 */
export function getArticleList(userId, offset, limit) {
  return request({
    url: '/article/list',
    params: {
      userId,
      offset,
      limit
    }
  })
}

/**
 * 获取文章详情
 * @param id {string | number}
 * @returns {Promise}
 */
export function getArticleDetail(id) {
  return request({
    url: '/article',
    params: {
      id
    }
  })
}

/**
 * 获取文章分类统计
 * @param userId {string | number}
 * @returns {Promise}
 */
export function getArticleClassify(userId) {
  return request({
    url: '/article/classify',
    params: {
      userId
    }
  })
}

/**
 * 获取分类文章
 * @param userId {string | number}
 * @param classify {string | menubar}
 * @returns {Promise}
 */
export function getArticleByClassify(userId, classify) {
  return request({
    url: `/article/classify/${classify}`,
    params: {
      userId
    }
  })
}
